package com.example.dds.tiancai;

import org.apache.tomcat.util.codec.binary.Base64;
import java.nio.charset.Charset;

/**
 * @Author: xielc
 * @Date: 2019/12/9 14:37
 * @Version 1.0
 */
public class Base64Utils {

    public static byte[] decode(String base64) {
        return Base64.decodeBase64(base64.getBytes(Charset.forName("UTF-8")));
    }

    public static String encode(byte[] bytes) {
        return new String(Base64.encodeBase64(bytes), Charset.forName("UTF-8"));
    }
}
